import java.util.Vector;

import com.pandora.model.BlockGroup;
import com.pandora.model.BuildingBlock;
import com.pandora.templating.BlockGroupTemplate;
import com.pandora.templating.TaskTemplate;


public class Test {
	
	public static void main(String[] args) {
		BlockGroupTemplate operation = new BlockGroupTemplate("Main operation","Main operation");
		TaskTemplate t = new TaskTemplate("Main task", "Main task");
		operation.getBuildingBlocks().add(t);
		BlockGroupTemplate group1 = new BlockGroupTemplate("Operation 1", "Operation 1");
		operation.getBuildingBlocks().add(group1);
		BlockGroupTemplate group11 = new BlockGroupTemplate("Operation 1.1", "Operation 1.1");
		group1.getBuildingBlocks().add(group11);
		TaskTemplate t2 = new TaskTemplate("Task 1.1.1", "Task 1.1.1");
		group1.getBuildingBlocks().add(t2);
		BlockGroup bg = operation.getInstance();
		print(bg);		
	}

	public static void print(BuildingBlock b) {
		System.out.println("Name: "+b.getName()+" Description: "+b.getDescription());
		if (b instanceof BlockGroup) {
			System.out.println("------ Sub blocks ------------");
			Vector<BuildingBlock> subBlocks = ((BlockGroup)b).getSubBlocks();
			for (BuildingBlock b2 : subBlocks) {
				print(b2);
			}
		}
	}
	
}
